package cn.yunhe.action;

import cn.yunhe.model.ErrorCondition;
import com.opensymphony.xwork2.ActionSupport;
import net.sf.json.JSONArray;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zs on 2017/11/22.
 */
public class ListAction extends BaseAction {

    List<ErrorCondition> list = new ArrayList<ErrorCondition>();

    @Override
    public String execute() throws Exception {
        ErrorCondition r1 = new ErrorCondition("张三", "4306821989021611", "L", "长度错误");
        ErrorCondition r2 = new ErrorCondition("李四", "430682198902191112", "X", "校验错误");
        ErrorCondition r3 = new ErrorCondition("王五", "", "N", "身份证信息为空");

        list.add(r1);
        list.add(r2);
        list.add(r3);

        //将list转换成json
        JSONArray jsonArray = JSONArray.fromObject(list);
        return "test2";
    }


    public List<ErrorCondition> getList() {
        return list;
    }

    public void setList(List<ErrorCondition> list) {
        this.list = list;
    }
}
